//
//  CHRightCell.m
//  CarFile
//
//  Created by 陈浩 on 2017/7/10.
//  Copyright © 2017年 陈浩. All rights reserved.
//

#import "CHRightCell.h"
@interface CHRightCell ()
@property (nonatomic ,strong) NSArray *datas;

@end
@implementation CHRightCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

+(instancetype)cellForTableView:(UITableView *)tableView{
    
    static NSString *ID = @"CHRightCell";
    
    CHRightCell *cell = [[CHRightCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    return cell;
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = [UIColor whiteColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self setupUI];
    }
    return self;
    
    
}


-(void)setupUI{

    
}

-(void)setModel:(DJ_Model *)model{
    
    _model = model;
    if (self.index == 0) {
        
        if (_isDocking) {
           _datas = @[model.comnum,model.registernum,model.dockcomnum,model.dockcomrate,model.uploadrate];
        }else{
            
           _datas = @[model.comnum,model.registernum,model.nodockcomnum,model.nodockcomrate];
        }
    }else{
        
        int noupload = [model.docknum intValue] - [model.uploadnum intValue];
        NSString *nouploadnum = [NSString stringWithFormat:@"%d",noupload];
        NSString *usertype = (NSString *)[Util getValue:@"usertype"];
        if ([usertype isEqualToString:@"99"]) {
           _datas = @[model.comnum,model.docknum,model.uploadnum,nouploadnum,model.uploarate];
        }else{
           _datas = @[model.comnum,model.docknum,model.uploadnum,nouploadnum,model.uploadrate];
        }
    }

    for (int i = 0; i < _datas.count; i++) {
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(i *(80+0.5), 0, 80- 0.5, 44-1)];
        label.font = [UIFont systemFontOfSize:12];
        label.textAlignment = NSTextAlignmentCenter;
        label.text = _datas[i];
        [self.contentView addSubview:label];
    }
    
    
}

@end
